package com.example.exception;

import com.example.enums.ErrorCode;

/**
 * 自定义异常类
 */
public class SelfRuntimeException extends RuntimeException{

    // 异常状态码
    private final ErrorCode code;

    // 异常信息
    private final String message;

    public SelfRuntimeException (ErrorCode code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public SelfRuntimeException (ErrorCode code, String message, Throwable e) {
        super(message, e);
        this.code = code;
        this.message = message;
    }

    public ErrorCode getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

}
